/*
 * RadioButton.h
 *
 *  Created on: 2010-12-15
 *      Author: wenjian
 */

#ifndef RADIOBUTTON_H_
#define RADIOBUTTON_H_

#include "../../commons.h"
#include "../../gdiplus/gdraw.h"
using namespace Ed;
namespace S {
  /**
   * 单选按钮
   */
  class RadioButton: public Ed::Element {
    public:
      //RadioButton(const wchar_t* iconfilename, const wchar_t* checkedIconfilename, real x, real y);
      RadioButton(real x, real y, bool checked=false);
      virtual ~RadioButton();


      void draw(Gdiplus::Graphics* g);

      bool isChecked(){
        return checkedFlag;
      }

      void setChecked(bool b){
        if(checkedFlag != b){
          checkedFlag = b;
          setModified(true);
        }
      }


    protected:
      void mouseMoveEvent(const MouseEvent* e);
      void mouseLeaveEvent(const MouseEvent* e);
      void mousePressEvent(const MouseEvent* e);

    private:
      Gdiplus::Bitmap* buttonImage;
      Gdiplus::Bitmap* checkedButtonImage;
//      //指示是否鼠标正悬停在元素上
//      bool isHovering;
      //是否被选中状态
      bool checkedFlag;
      Gdiplus::Pen* pen;
      Gdiplus::Brush* brush;
  };

}

#endif /* RADIOBUTTON_H_ */
